<template>
    <div>
        <el-cascader
            v-model="vals"
            :options="options"
            :props="props"
            clearable
            @change="changeHandle"
        />
    </div>
</template>

<script>
import {
    regionData
} from './data'

export default {
    name: 'ProvinceCity',
    props: {
        value: {
            type: Array,
            default: () => {}
        }
    },
    data() {
        return {
            options: regionData,
            props: {
                label: 'label',
                value: 'label',
                children: 'children'
            },
            vals: this.value
        }
    },
    watch: {
        value: {
            handler(value) {
                this.vals = this.value
            },
            deep: true 
        }
    },
    methods: {
        changeHandle(val) {
            // val = val.join('/')
            this.$emit('input', val)
        }
    }
}
</script>
